MODE STUD

integer channel = 72;

string mode = "defense";

string text = "Defensive Mode";
default
{
    state_entry()
    {
        llSetText(text,<1,1,1>,1);
    }
    touch_start(integer total_number)
    {
        llSay(channel,"/ls mode " + mode);
        llMessageLinked(LINK_SET,0,mode,NULL_KEY);
        llSetColor(<1,0,0>,ALL_SIDES);

                 
        
    }
    link_message(integer sender,integer num,string msg,key id)
    {
        if(msg == "HIDE")
        {
            llSetAlpha(0,ALL_SIDES);
            llSetText("",<1,1,1>,1);
            state hidden;
        }
        if(msg != mode && num == 0)
        {
            llSetColor(<1,1,1>,ALL_SIDES);
        }
    }
}

state hidden
{
    link_message(integer sender,integer num,string msg,key id)
    {
        if(msg == "SHOW")
        {
            llSetAlpha(1,ALL_SIDES);
            
            state default;
        }

    }
}